#pragma once

#include <string>
#include <vector>
#include "Pointer.h"

struct Type
{
	typedef std::vector<Type> Vector_t;

	Type( unsigned int offset, unsigned int size, unsigned int parameter ) : m_parameter(parameter), m_offset(offset), m_size(size)
	{
	};

	unsigned int m_parameter;
	unsigned int m_offset;
	unsigned int m_size;
};

struct MdlFileMaterial
{
	MdlFileMaterial() : shaderName("nil")
	{
		for (int i = 0; i < 4; ++i)
		{
			ambient[i] = 1.0f;
			diffuse[i] = 1.0f;
			specular[i] = 1.0f;
		}
		shininess = 1.0f;
		memset(&emmisive, 0, sizeof(float) * 4);
	};
	float ambient[4], diffuse[4], specular[4], emmisive[4], shininess;
	std::string shaderName;
};

struct MdlFileUniform
{
	std::string uniformName;
	std::string uniformType;
	unsigned int numberOfElements;
};

struct MdlFileMesh
{
	MdlFileMaterial material;
	std::vector<MdlFileUniform> uniforms;
	Type::Vector_t parameters;
	unsigned int vertexCount;
	std::vector<unsigned char> vertexData;
};

struct MdlFile
{
	std::string modelName;
	std::string skeletonName;
	std::vector<MdlFileMesh> meshes;
};

bool LoadMdlFile( std::string& filename, MdlFile& file );